﻿<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>maven release</title>
</head>
<body>
<div id="wmd-preview" class="wmd-preview"><div class="md-section-divider"></div><div class="md-section-divider"></div><h1 data-anchor-id="1xo1" id="maven-release">maven release</h1><hr><div class="md-section-divider"></div><h2 data-anchor-id="55fc" id="版本">版本</h2><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="sdek"><ol class="linenums"><li class="L0"><code><span class="pln">maven</span><span class="pun">-</span><span class="lit">3.2</span><span class="pun">.</span><span class="lit">5</span></code></li><li class="L1"><code><span class="pln">gpg4win</span><span class="pun">-</span><span class="lit">2.3</span><span class="pun">.</span><span class="lit">4</span></code></li></ol></pre><div class="md-section-divider"></div><h2 data-anchor-id="9zxy" id="初始阶段">初始阶段</h2><ol data-anchor-id="6kc4">
<li>注册一个JIRA账号：<a href="https://issues.sonatype.org/secure/Signup!default.jspa" target="_blank">https://issues.sonatype.org/secure/Signup!default.jspa</a></li>
<li>创建一个新工程的单：<a href="https://issues.sonatype.org/secure/CreateIssue.jspa?issuetype=21&amp;pid=10134" target="_blank">https://issues.sonatype.org/secure/CreateIssue.jspa?issuetype=21&amp;pid=10134</a> <br>
只有当这个jira单的状态我resolved时，才可以提交jar包</li>
</ol><div class="md-section-divider"></div><h2 data-anchor-id="9drq" id="审查要求">审查要求</h2><ol data-anchor-id="eo5t">
<li>提供javadoc和source</li>
<li>使用gpg或者pgp对文件进行签名</li>
<li>pom.xml文件</li>
<li>正确的坐标：groupId,artifactId,version</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="yyx6"><ol class="linenums"><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;groupId&gt;</span><span class="pln">com.github.fartherp</span><span class="tag">&lt;/groupId&gt;</span></code></li><li class="L1"><code><span class="pln">    </span><span class="tag">&lt;artifactId&gt;</span><span class="pln">framework</span><span class="tag">&lt;/artifactId&gt;</span></code></li><li class="L2"><code><span class="pln">    </span><span class="tag">&lt;version&gt;</span><span class="pln">1.0-SNAPSHOT</span><span class="tag">&lt;/version&gt;</span></code></li></ol></pre><ol data-anchor-id="nlyk">
<li>projectName,description,url等</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="fjz1"><ol class="linenums"><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;name&gt;</span><span class="pln">framework</span><span class="tag">&lt;/name&gt;</span></code></li><li class="L1"><code><span class="pln">    </span><span class="tag">&lt;url&gt;</span><span class="pln">https://github.com/fartherp/framework</span><span class="tag">&lt;/url&gt;</span></code></li><li class="L2"><code><span class="pln">    </span><span class="tag">&lt;description&gt;</span><span class="pln">framework</span><span class="tag">&lt;/description&gt;</span></code></li></ol></pre><ol data-anchor-id="cfna">
<li>license 信息</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="mn05"><ol class="linenums"><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;licenses&gt;</span></code></li><li class="L1"><code><span class="pln">        </span><span class="tag">&lt;license&gt;</span></code></li><li class="L2"><code><span class="pln">            </span><span class="tag">&lt;name&gt;</span><span class="pln">The Apache Software License, Version 2.0</span><span class="tag">&lt;/name&gt;</span></code></li><li class="L3"><code><span class="pln">            </span><span class="tag">&lt;url&gt;</span><span class="pln">http://www.apache.org/licenses/LICENSE-2.0.txt</span><span class="tag">&lt;/url&gt;</span></code></li><li class="L4"><code><span class="pln">            </span><span class="tag">&lt;distribution&gt;</span><span class="pln">repo</span><span class="tag">&lt;/distribution&gt;</span></code></li><li class="L5"><code><span class="pln">        </span><span class="tag">&lt;/license&gt;</span></code></li><li class="L6"><code><span class="pln">    </span><span class="tag">&lt;/licenses&gt;</span></code></li></ol></pre><ol data-anchor-id="il3f">
<li>开发者信息</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="s8t5"><ol class="linenums"><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;developers&gt;</span></code></li><li class="L1"><code><span class="pln">        </span><span class="tag">&lt;developer&gt;</span></code></li><li class="L2"><code><span class="pln">            </span><span class="tag">&lt;id&gt;</span><span class="pln">ck</span><span class="tag">&lt;/id&gt;</span></code></li><li class="L3"><code><span class="pln">            </span><span class="tag">&lt;name&gt;</span><span class="pln">ck</span><span class="tag">&lt;/name&gt;</span></code></li><li class="L4"><code><span class="pln">            </span><span class="tag">&lt;email&gt;</span><span class="pln">yuqiang.cui@gmail.com</span><span class="tag">&lt;/email&gt;</span></code></li><li class="L5"><code><span class="pln">        </span><span class="tag">&lt;/developer&gt;</span></code></li><li class="L6"><code><span class="pln">        </span><span class="tag">&lt;developer&gt;</span></code></li><li class="L7"><code><span class="pln">            </span><span class="tag">&lt;id&gt;</span><span class="pln">wyzhangjie</span><span class="tag">&lt;/id&gt;</span></code></li><li class="L8"><code><span class="pln">            </span><span class="tag">&lt;name&gt;</span><span class="pln">wyzhangjie</span><span class="tag">&lt;/name&gt;</span></code></li><li class="L9"><code><span class="pln">        </span><span class="tag">&lt;/developer&gt;</span></code></li><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;/developers&gt;</span></code></li></ol></pre><ol data-anchor-id="4wyf">
<li>SCM信息</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="tinv"><ol class="linenums"><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;scm&gt;</span></code></li><li class="L1"><code><span class="pln">        </span><span class="tag">&lt;connection&gt;</span><span class="pln">scm:git:git@github.com:fartherp/framework.git</span><span class="tag">&lt;/connection&gt;</span></code></li><li class="L2"><code><span class="pln">        </span><span class="tag">&lt;developerConnection&gt;</span><span class="pln">scm:git:git@github.com:fartherp/framework.git</span><span class="tag">&lt;/developerConnection&gt;</span></code></li><li class="L3"><code><span class="pln">        </span><span class="tag">&lt;url&gt;</span><span class="pln">https://github.com/fartherp/framework</span><span class="tag">&lt;/url&gt;</span></code></li><li class="L4"><code><span class="pln">        </span><span class="tag">&lt;tag&gt;</span><span class="pln">HEAD</span><span class="tag">&lt;/tag&gt;</span></code></li><li class="L5"><code><span class="pln">    </span><span class="tag">&lt;/scm&gt;</span></code></li></ol></pre><div class="md-section-divider"></div><h2 data-anchor-id="4xtz" id="部署maven">部署（maven）</h2><ol data-anchor-id="5xl5">
<li>分布管理和认证: pom.xml</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="n2a4"><ol class="linenums"><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;distributionManagement&gt;</span></code></li><li class="L1"><code><span class="pln">        </span><span class="tag">&lt;repository&gt;</span></code></li><li class="L2"><code><span class="pln">            </span><span class="tag">&lt;id&gt;</span><span class="pln">oss</span><span class="tag">&lt;/id&gt;</span></code></li><li class="L3"><code><span class="pln">            </span><span class="tag">&lt;name&gt;</span><span class="pln">Nexus Release Repository</span><span class="tag">&lt;/name&gt;</span></code></li><li class="L4"><code><span class="pln">            </span><span class="tag">&lt;url&gt;</span><span class="pln">https://oss.sonatype.org/service/local/staging/deploy/maven2/</span><span class="tag">&lt;/url&gt;</span></code></li><li class="L5"><code><span class="pln">        </span><span class="tag">&lt;/repository&gt;</span></code></li><li class="L6"><code><span class="pln">        </span><span class="tag">&lt;snapshotRepository&gt;</span></code></li><li class="L7"><code><span class="pln">            </span><span class="tag">&lt;id&gt;</span><span class="pln">oss</span><span class="tag">&lt;/id&gt;</span></code></li><li class="L8"><code><span class="pln">            </span><span class="tag">&lt;name&gt;</span><span class="pln">Nexus Snapshot Repository</span><span class="tag">&lt;/name&gt;</span></code></li><li class="L9"><code><span class="pln">            </span><span class="tag">&lt;url&gt;</span><span class="pln">https://oss.sonatype.org/content/repositories/snapshots/</span><span class="tag">&lt;/url&gt;</span></code></li><li class="L0"><code><span class="pln">        </span><span class="tag">&lt;/snapshotRepository&gt;</span></code></li><li class="L1"><code><span class="pln">    </span><span class="tag">&lt;/distributionManagement&gt;</span></code></li></ol></pre><ol data-anchor-id="9ib2">
<li>settings.xml配置jira的账号和密码<strong>(和上面的id一样)</strong></li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="uegv"><ol class="linenums"><li class="L0"><code><span class="pln">  </span><span class="tag">&lt;servers&gt;</span></code></li><li class="L1"><code><span class="pln">    </span><span class="tag">&lt;server&gt;</span></code></li><li class="L2"><code><span class="pln">      </span><span class="tag">&lt;id&gt;</span><span class="pln">oss</span><span class="tag">&lt;/id&gt;</span></code></li><li class="L3"><code><span class="pln">      </span><span class="tag">&lt;username&gt;</span><span class="pln">your-jira-id</span><span class="tag">&lt;/username&gt;</span></code></li><li class="L4"><code><span class="pln">      </span><span class="tag">&lt;password&gt;</span><span class="pln">your-jira-pwd</span><span class="tag">&lt;/password&gt;</span></code></li><li class="L5"><code><span class="pln">    </span><span class="tag">&lt;/server&gt;</span></code></li><li class="L6"><code><span class="pln">  </span><span class="tag">&lt;/servers&gt;</span></code></li></ol></pre><ol data-anchor-id="noqq">
<li>配置生成javadoc和sources包的插件</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="rfbd"><ol class="linenums"><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;plugin&gt;</span></code></li><li class="L1"><code><span class="pln">        </span><span class="tag">&lt;groupId&gt;</span><span class="pln">org.apache.maven.plugins</span><span class="tag">&lt;/groupId&gt;</span></code></li><li class="L2"><code><span class="pln">        </span><span class="tag">&lt;artifactId&gt;</span><span class="pln">maven-source-plugin</span><span class="tag">&lt;/artifactId&gt;</span></code></li><li class="L3"><code><span class="pln">        </span><span class="tag">&lt;version&gt;</span><span class="pln">2.2.1</span><span class="tag">&lt;/version&gt;</span></code></li><li class="L4"><code><span class="pln">        </span><span class="tag">&lt;executions&gt;</span></code></li><li class="L5"><code><span class="pln">            </span><span class="tag">&lt;execution&gt;</span></code></li><li class="L6"><code><span class="pln">                </span><span class="tag">&lt;id&gt;</span><span class="pln">attach-sources</span><span class="tag">&lt;/id&gt;</span></code></li><li class="L7"><code><span class="pln">                </span><span class="tag">&lt;phase&gt;</span><span class="pln">package</span><span class="tag">&lt;/phase&gt;</span></code></li><li class="L8"><code><span class="pln">                </span><span class="tag">&lt;goals&gt;</span></code></li><li class="L9"><code><span class="pln">                    </span><span class="tag">&lt;goal&gt;</span><span class="pln">jar-no-fork</span><span class="tag">&lt;/goal&gt;</span></code></li><li class="L0"><code><span class="pln">                </span><span class="tag">&lt;/goals&gt;</span></code></li><li class="L1"><code><span class="pln">            </span><span class="tag">&lt;/execution&gt;</span></code></li><li class="L2"><code><span class="pln">        </span><span class="tag">&lt;/executions&gt;</span></code></li><li class="L3"><code><span class="pln">    </span><span class="tag">&lt;/plugin&gt;</span></code></li><li class="L4"><code><span class="pln">    </span><span class="tag">&lt;plugin&gt;</span></code></li><li class="L5"><code><span class="pln">        </span><span class="tag">&lt;groupId&gt;</span><span class="pln">org.apache.maven.plugins</span><span class="tag">&lt;/groupId&gt;</span></code></li><li class="L6"><code><span class="pln">        </span><span class="tag">&lt;artifactId&gt;</span><span class="pln">maven-javadoc-plugin</span><span class="tag">&lt;/artifactId&gt;</span></code></li><li class="L7"><code><span class="pln">        </span><span class="tag">&lt;version&gt;</span><span class="pln">2.9.1</span><span class="tag">&lt;/version&gt;</span></code></li><li class="L8"><code><span class="pln">        </span><span class="tag">&lt;executions&gt;</span></code></li><li class="L9"><code><span class="pln">            </span><span class="tag">&lt;execution&gt;</span></code></li><li class="L0"><code><span class="pln">                </span><span class="tag">&lt;id&gt;</span><span class="pln">attach-javadocs</span><span class="tag">&lt;/id&gt;</span></code></li><li class="L1"><code><span class="pln">                </span><span class="tag">&lt;goals&gt;</span></code></li><li class="L2"><code><span class="pln">                    </span><span class="tag">&lt;goal&gt;</span><span class="pln">jar</span><span class="tag">&lt;/goal&gt;</span></code></li><li class="L3"><code><span class="pln">                </span><span class="tag">&lt;/goals&gt;</span></code></li><li class="L4"><code><span class="pln">            </span><span class="tag">&lt;/execution&gt;</span></code></li><li class="L5"><code><span class="pln">        </span><span class="tag">&lt;/executions&gt;</span></code></li><li class="L6"><code><span class="pln">    </span><span class="tag">&lt;/plugin&gt;</span></code></li></ol></pre><ol data-anchor-id="2z48">
<li>GPG自动签名的插件</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="nauw"><ol class="linenums"><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;plugin&gt;</span></code></li><li class="L1"><code><span class="pln">        </span><span class="tag">&lt;groupId&gt;</span><span class="pln">org.apache.maven.plugins</span><span class="tag">&lt;/groupId&gt;</span></code></li><li class="L2"><code><span class="pln">        </span><span class="tag">&lt;artifactId&gt;</span><span class="pln">maven-gpg-plugin</span><span class="tag">&lt;/artifactId&gt;</span></code></li><li class="L3"><code><span class="pln">        </span><span class="tag">&lt;version&gt;</span><span class="pln">1.6</span><span class="tag">&lt;/version&gt;</span></code></li><li class="L4"><code><span class="pln">        </span><span class="tag">&lt;executions&gt;</span></code></li><li class="L5"><code><span class="pln">            </span><span class="tag">&lt;execution&gt;</span></code></li><li class="L6"><code><span class="pln">                </span><span class="tag">&lt;id&gt;</span><span class="pln">sign-artifacts</span><span class="tag">&lt;/id&gt;</span></code></li><li class="L7"><code><span class="pln">                </span><span class="tag">&lt;phase&gt;</span><span class="pln">verify</span><span class="tag">&lt;/phase&gt;</span></code></li><li class="L8"><code><span class="pln">                </span><span class="tag">&lt;goals&gt;</span></code></li><li class="L9"><code><span class="pln">                    </span><span class="tag">&lt;goal&gt;</span><span class="pln">sign</span><span class="tag">&lt;/goal&gt;</span></code></li><li class="L0"><code><span class="pln">                </span><span class="tag">&lt;/goals&gt;</span></code></li><li class="L1"><code><span class="pln">            </span><span class="tag">&lt;/execution&gt;</span></code></li><li class="L2"><code><span class="pln">        </span><span class="tag">&lt;/executions&gt;</span></code></li><li class="L3"><code><span class="pln">    </span><span class="tag">&lt;/plugin&gt;</span></code></li></ol></pre><p data-anchor-id="n4au">maven-settings.xml中配置gpg的签名: （需要先用gpg来生成）</p><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="zixv"><ol class="linenums"><li class="L0"><code><span class="pln">    </span><span class="tag">&lt;profile&gt;</span></code></li><li class="L1"><code><span class="pln">      </span><span class="tag">&lt;id&gt;</span><span class="pln">oss</span><span class="tag">&lt;/id&gt;</span></code></li><li class="L2"><code><span class="pln">      </span><span class="tag">&lt;activation&gt;</span></code></li><li class="L3"><code><span class="pln">        </span><span class="tag">&lt;activeByDefault&gt;</span><span class="pln">true</span><span class="tag">&lt;/activeByDefault&gt;</span></code></li><li class="L4"><code><span class="pln">      </span><span class="tag">&lt;/activation&gt;</span></code></li><li class="L5"><code><span class="pln">      </span><span class="tag">&lt;properties&gt;</span></code></li><li class="L6"><code><span class="pln">        </span><span class="tag">&lt;gpg.executable&gt;</span><span class="pln">gpg</span><span class="tag">&lt;/gpg.executable&gt;</span></code></li><li class="L7"><code><span class="pln">        </span><span class="tag">&lt;gpg.passphrase&gt;</span><span class="pln">qwertyuiop</span><span class="tag">&lt;/gpg.passphrase&gt;</span></code></li><li class="L8"><code><span class="pln">      </span><span class="tag">&lt;/properties&gt;</span></code></li><li class="L9"><code><span class="pln">    </span><span class="tag">&lt;/profile&gt;</span></code></li></ol></pre><ol data-anchor-id="yd9p">
<li>使用Profile</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="eohh"><ol class="linenums"><li class="L0"><code><span class="pun">应该</span><span class="pln">javadoc</span><span class="pun">和</span><span class="pln">source</span><span class="pun">的</span><span class="pln">jar</span><span class="pun">包生成也需要使用</span><span class="pln">gpg</span><span class="pun">来签名，所以很浪费时间，而且这些执行通常都独立于标准构建流程，所以把他们移动到一个</span><span class="pln">profile</span><span class="pun">.</span></code></li><li class="L1"><code><span class="pln"> </span><span class="str">&lt;profiles&gt;</span></code></li><li class="L2"><code><span class="pln">   </span><span class="str">&lt;profile&gt;</span><span class="pln"> </span></code></li><li class="L3"><code><span class="pln">    </span><span class="str">&lt;id&gt;</span><span class="pln">release</span><span class="pun">&lt;/</span><span class="pln">id</span><span class="pun">&gt;</span></code></li><li class="L4"><code><span class="pln">    </span><span class="str">&lt;build&gt;</span></code></li><li class="L5"><code><span class="pln">        </span><span class="str">&lt;plugins&gt;</span></code></li><li class="L6"><code><span class="pln">            </span><span class="str">&lt;plugin&gt;</span></code></li><li class="L7"><code><span class="pln">               </span><span class="str">&lt;groupId&gt;</span><span class="pln">org</span><span class="pun">.</span><span class="pln">sonatype</span><span class="pun">.</span><span class="pln">plugins</span><span class="pun">&lt;/</span><span class="pln">groupId</span><span class="pun">&gt;</span></code></li><li class="L8"><code><span class="pln">               </span><span class="str">&lt;artifactId&gt;</span><span class="pln">nexus</span><span class="pun">-</span><span class="pln">staging</span><span class="pun">-</span><span class="pln">maven</span><span class="pun">-</span><span class="pln">plugin</span><span class="pun">&lt;/</span><span class="pln">artifactId</span><span class="pun">&gt;</span></code></li><li class="L9"><code><span class="pln">               </span><span class="str">&lt;version&gt;</span><span class="lit">1.6</span><span class="pun">.</span><span class="lit">3</span><span class="pun">&lt;/</span><span class="pln">version</span><span class="pun">&gt;</span></code></li><li class="L0"><code><span class="pln">               </span><span class="str">&lt;extensions&gt;</span><span class="kwd">true</span><span class="pun">&lt;/</span><span class="pln">extensions</span><span class="pun">&gt;</span></code></li><li class="L1"><code><span class="pln">               </span><span class="str">&lt;configuration&gt;</span></code></li><li class="L2"><code><span class="pln">                 </span><span class="str">&lt;serverId&gt;</span><span class="pln">ossrh</span><span class="pun">&lt;/</span><span class="pln">serverId</span><span class="pun">&gt;</span></code></li><li class="L3"><code><span class="pln">                 </span><span class="str">&lt;nexusUrl&gt;</span><span class="pln">https</span><span class="pun">:</span><span class="com">//oss.sonatype.org/&lt;/nexusUrl&gt;</span></code></li><li class="L4"><code><span class="pln">                 </span><span class="str">&lt;autoReleaseAfterClose&gt;</span><span class="kwd">true</span><span class="pun">&lt;/</span><span class="pln">autoReleaseAfterClose</span><span class="pun">&gt;</span></code></li><li class="L5"><code><span class="pln">               </span><span class="pun">&lt;/</span><span class="pln">configuration</span><span class="pun">&gt;</span></code></li><li class="L6"><code><span class="pln">             </span><span class="pun">&lt;/</span><span class="pln">plugin</span><span class="pun">&gt;</span></code></li><li class="L7"><code><span class="pln">             </span><span class="str">&lt;plugin&gt;</span></code></li><li class="L8"><code><span class="pln">                 </span><span class="str">&lt;groupId&gt;</span><span class="pln">org</span><span class="pun">.</span><span class="pln">apache</span><span class="pun">.</span><span class="pln">maven</span><span class="pun">.</span><span class="pln">plugins</span><span class="pun">&lt;/</span><span class="pln">groupId</span><span class="pun">&gt;</span></code></li><li class="L9"><code><span class="pln">                 </span><span class="str">&lt;artifactId&gt;</span><span class="pln">maven</span><span class="pun">-</span><span class="pln">release</span><span class="pun">-</span><span class="pln">plugin</span><span class="pun">&lt;/</span><span class="pln">artifactId</span><span class="pun">&gt;</span></code></li><li class="L0"><code><span class="pln">                 </span><span class="str">&lt;version&gt;</span><span class="lit">2.5</span><span class="pun">&lt;/</span><span class="pln">version</span><span class="pun">&gt;</span></code></li><li class="L1"><code><span class="pln">                 </span><span class="str">&lt;configuration&gt;</span></code></li><li class="L2"><code><span class="pln">                   </span><span class="str">&lt;autoVersionSubmodules&gt;</span><span class="kwd">true</span><span class="pun">&lt;/</span><span class="pln">autoVersionSubmodules</span><span class="pun">&gt;</span></code></li><li class="L3"><code><span class="pln">                   </span><span class="str">&lt;useReleaseProfile&gt;</span><span class="kwd">false</span><span class="pun">&lt;/</span><span class="pln">useReleaseProfile</span><span class="pun">&gt;</span></code></li><li class="L4"><code><span class="pln">                   </span><span class="str">&lt;releaseProfiles&gt;</span><span class="pln">release</span><span class="pun">&lt;/</span><span class="pln">releaseProfiles</span><span class="pun">&gt;</span></code></li><li class="L5"><code><span class="pln">                   </span><span class="str">&lt;goals&gt;</span><span class="pln">deploy</span><span class="pun">&lt;/</span><span class="pln">goals</span><span class="pun">&gt;</span></code></li><li class="L6"><code><span class="pln">                 </span><span class="pun">&lt;/</span><span class="pln">configuration</span><span class="pun">&gt;</span></code></li><li class="L7"><code><span class="pln">            </span><span class="pun">&lt;/</span><span class="pln">plugin</span><span class="pun">&gt;</span></code></li><li class="L8"><code><span class="pln">            </span><span class="str">&lt;plugin&gt;</span></code></li><li class="L9"><code><span class="pln">                </span><span class="str">&lt;groupId&gt;</span><span class="pln">org</span><span class="pun">.</span><span class="pln">apache</span><span class="pun">.</span><span class="pln">maven</span><span class="pun">.</span><span class="pln">plugins</span><span class="pun">&lt;/</span><span class="pln">groupId</span><span class="pun">&gt;</span></code></li><li class="L0"><code><span class="pln">                </span><span class="str">&lt;artifactId&gt;</span><span class="pln">maven</span><span class="pun">-</span><span class="pln">compiler</span><span class="pun">-</span><span class="pln">plugin</span><span class="pun">&lt;/</span><span class="pln">artifactId</span><span class="pun">&gt;</span></code></li><li class="L1"><code><span class="pln">                </span><span class="str">&lt;version&gt;</span><span class="lit">3.0</span><span class="pun">&lt;/</span><span class="pln">version</span><span class="pun">&gt;</span></code></li><li class="L2"><code><span class="pln">                </span><span class="str">&lt;configuration&gt;</span></code></li><li class="L3"><code><span class="pln">                    </span><span class="str">&lt;source&gt;</span><span class="lit">1.6</span><span class="pun">&lt;/</span><span class="pln">source</span><span class="pun">&gt;</span></code></li><li class="L4"><code><span class="pln">                    </span><span class="str">&lt;target&gt;</span><span class="lit">1.6</span><span class="pun">&lt;/</span><span class="pln">target</span><span class="pun">&gt;</span></code></li><li class="L5"><code><span class="pln">                </span><span class="pun">&lt;/</span><span class="pln">configuration</span><span class="pun">&gt;</span></code></li><li class="L6"><code><span class="pln">            </span><span class="pun">&lt;/</span><span class="pln">plugin</span><span class="pun">&gt;</span></code></li><li class="L7"><code><span class="pln">            </span><span class="str">&lt;plugin&gt;</span></code></li><li class="L8"><code><span class="pln">               </span><span class="str">&lt;groupId&gt;</span><span class="pln">org</span><span class="pun">.</span><span class="pln">apache</span><span class="pun">.</span><span class="pln">maven</span><span class="pun">.</span><span class="pln">plugins</span><span class="pun">&lt;/</span><span class="pln">groupId</span><span class="pun">&gt;</span></code></li><li class="L9"><code><span class="pln">               </span><span class="str">&lt;artifactId&gt;</span><span class="pln">maven</span><span class="pun">-</span><span class="pln">gpg</span><span class="pun">-</span><span class="pln">plugin</span><span class="pun">&lt;/</span><span class="pln">artifactId</span><span class="pun">&gt;</span></code></li><li class="L0"><code><span class="pln">               </span><span class="str">&lt;version&gt;</span><span class="lit">1.5</span><span class="pun">&lt;/</span><span class="pln">version</span><span class="pun">&gt;</span></code></li><li class="L1"><code><span class="pln">               </span><span class="str">&lt;executions&gt;</span></code></li><li class="L2"><code><span class="pln">                 </span><span class="str">&lt;execution&gt;</span></code></li><li class="L3"><code><span class="pln">                   </span><span class="str">&lt;id&gt;</span><span class="pln">sign</span><span class="pun">-</span><span class="pln">artifacts</span><span class="pun">&lt;/</span><span class="pln">id</span><span class="pun">&gt;</span></code></li><li class="L4"><code><span class="pln">                   </span><span class="str">&lt;phase&gt;</span><span class="pln">verify</span><span class="pun">&lt;/</span><span class="pln">phase</span><span class="pun">&gt;</span></code></li><li class="L5"><code><span class="pln">                   </span><span class="str">&lt;goals&gt;</span></code></li><li class="L6"><code><span class="pln">                     </span><span class="str">&lt;goal&gt;</span><span class="pln">sign</span><span class="pun">&lt;/</span><span class="pln">goal</span><span class="pun">&gt;</span></code></li><li class="L7"><code><span class="pln">                   </span><span class="pun">&lt;/</span><span class="pln">goals</span><span class="pun">&gt;</span></code></li><li class="L8"><code><span class="pln">                 </span><span class="pun">&lt;/</span><span class="pln">execution</span><span class="pun">&gt;</span></code></li><li class="L9"><code><span class="pln">               </span><span class="pun">&lt;/</span><span class="pln">executions</span><span class="pun">&gt;</span></code></li><li class="L0"><code><span class="pln">            </span><span class="pun">&lt;/</span><span class="pln">plugin</span><span class="pun">&gt;</span></code></li><li class="L1"><code><span class="pln">            </span><span class="str">&lt;plugin&gt;</span></code></li><li class="L2"><code><span class="pln">                </span><span class="str">&lt;groupId&gt;</span><span class="pln">org</span><span class="pun">.</span><span class="pln">apache</span><span class="pun">.</span><span class="pln">maven</span><span class="pun">.</span><span class="pln">plugins</span><span class="pun">&lt;/</span><span class="pln">groupId</span><span class="pun">&gt;</span></code></li><li class="L3"><code><span class="pln">                </span><span class="str">&lt;artifactId&gt;</span><span class="pln">maven</span><span class="pun">-</span><span class="pln">source</span><span class="pun">-</span><span class="pln">plugin</span><span class="pun">&lt;/</span><span class="pln">artifactId</span><span class="pun">&gt;</span></code></li><li class="L4"><code><span class="pln">                </span><span class="str">&lt;version&gt;</span><span class="lit">2.2</span><span class="pun">.</span><span class="lit">1</span><span class="pun">&lt;/</span><span class="pln">version</span><span class="pun">&gt;</span></code></li><li class="L5"><code><span class="pln">                </span><span class="str">&lt;executions&gt;</span></code></li><li class="L6"><code><span class="pln">                    </span><span class="str">&lt;execution&gt;</span></code></li><li class="L7"><code><span class="pln">                        </span><span class="str">&lt;id&gt;</span><span class="pln">attach</span><span class="pun">-</span><span class="pln">sources</span><span class="pun">&lt;/</span><span class="pln">id</span><span class="pun">&gt;</span></code></li><li class="L8"><code><span class="pln">                        </span><span class="str">&lt;goals&gt;</span></code></li><li class="L9"><code><span class="pln">                            </span><span class="str">&lt;goal&gt;</span><span class="pln">jar</span><span class="pun">-</span><span class="kwd">no</span><span class="pun">-</span><span class="pln">fork</span><span class="pun">&lt;/</span><span class="pln">goal</span><span class="pun">&gt;</span></code></li><li class="L0"><code><span class="pln">                        </span><span class="pun">&lt;/</span><span class="pln">goals</span><span class="pun">&gt;</span></code></li><li class="L1"><code><span class="pln">                    </span><span class="pun">&lt;/</span><span class="pln">execution</span><span class="pun">&gt;</span></code></li><li class="L2"><code><span class="pln">                </span><span class="pun">&lt;/</span><span class="pln">executions</span><span class="pun">&gt;</span></code></li><li class="L3"><code><span class="pln">            </span><span class="pun">&lt;/</span><span class="pln">plugin</span><span class="pun">&gt;</span></code></li><li class="L4"><code><span class="pln">            </span><span class="str">&lt;plugin&gt;</span></code></li><li class="L5"><code><span class="pln">                </span><span class="str">&lt;groupId&gt;</span><span class="pln">org</span><span class="pun">.</span><span class="pln">apache</span><span class="pun">.</span><span class="pln">maven</span><span class="pun">.</span><span class="pln">plugins</span><span class="pun">&lt;/</span><span class="pln">groupId</span><span class="pun">&gt;</span></code></li><li class="L6"><code><span class="pln">                </span><span class="str">&lt;artifactId&gt;</span><span class="pln">maven</span><span class="pun">-</span><span class="pln">javadoc</span><span class="pun">-</span><span class="pln">plugin</span><span class="pun">&lt;/</span><span class="pln">artifactId</span><span class="pun">&gt;</span></code></li><li class="L7"><code><span class="pln">                </span><span class="str">&lt;version&gt;</span><span class="lit">2.9</span><span class="pun">&lt;/</span><span class="pln">version</span><span class="pun">&gt;</span></code></li><li class="L8"><code><span class="pln">                </span><span class="str">&lt;executions&gt;</span></code></li><li class="L9"><code><span class="pln">                    </span><span class="str">&lt;execution&gt;</span></code></li><li class="L0"><code><span class="pln">                        </span><span class="str">&lt;id&gt;</span><span class="pln">attach</span><span class="pun">-</span><span class="pln">javadocs</span><span class="pun">&lt;/</span><span class="pln">id</span><span class="pun">&gt;</span></code></li><li class="L1"><code><span class="pln">                        </span><span class="str">&lt;goals&gt;</span></code></li><li class="L2"><code><span class="pln">                            </span><span class="str">&lt;goal&gt;</span><span class="pln">jar</span><span class="pun">&lt;/</span><span class="pln">goal</span><span class="pun">&gt;</span></code></li><li class="L3"><code><span class="pln">                        </span><span class="pun">&lt;/</span><span class="pln">goals</span><span class="pun">&gt;</span></code></li><li class="L4"><code><span class="pln">                    </span><span class="pun">&lt;/</span><span class="pln">execution</span><span class="pun">&gt;</span></code></li><li class="L5"><code><span class="pln">                </span><span class="pun">&lt;/</span><span class="pln">executions</span><span class="pun">&gt;</span></code></li><li class="L6"><code><span class="pln">            </span><span class="pun">&lt;/</span><span class="pln">plugin</span><span class="pun">&gt;</span></code></li><li class="L7"><code><span class="pln">         </span><span class="pun">&lt;/</span><span class="pln">plugins</span><span class="pun">&gt;</span></code></li><li class="L8"><code><span class="pln">    </span><span class="pun">&lt;/</span><span class="pln">build</span><span class="pun">&gt;</span></code></li><li class="L9"><code><span class="pln">  </span><span class="pun">&lt;/</span><span class="pln">profile</span><span class="pun">&gt;</span></code></li><li class="L0"><code><span class="pun">&lt;/</span><span class="pln">profiles</span><span class="pun">&gt;</span></code></li></ol></pre><ol data-anchor-id="t7bg">
<li>提交snapshot版本</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="h5wt"><ol class="linenums"><li class="L0"><code><span class="pln">mvn clean deploy</span></code></li></ol></pre><ol data-anchor-id="29oh">
<li>发布release版本</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="ijyw"><ol class="linenums"><li class="L0"><code><span class="lit">1.</span><span class="pln"> </span><span class="pun">修改</span><span class="pln">version</span></code></li><li class="L1"><code><span class="pln">mvn versions</span><span class="pun">:</span><span class="kwd">set</span><span class="pln"> </span><span class="pun">-</span><span class="typ">DnewVersion</span><span class="pun">=</span><span class="lit">1.0</span><span class="pun">.</span><span class="lit">0</span></code></li><li class="L2"><code><span class="lit">2.</span><span class="pln"> </span><span class="pun">执行</span><span class="pln"> </span></code></li><li class="L3"><code><span class="pln">mvn clean deploy </span><span class="pun">-</span><span class="pln">P release</span></code></li></ol></pre><ol data-anchor-id="t6jl">
<li>回滚版本</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="3pf1"><ol class="linenums"><li class="L0"><code><span class="pln">mvn versions</span><span class="pun">:</span><span class="pln">revert</span></code></li></ol></pre><ol data-anchor-id="pzjc">
<li>提交版本</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="xtj7"><ol class="linenums"><li class="L0"><code><span class="pln">mvn versions</span><span class="pun">:</span><span class="pln">commit</span></code></li></ol></pre><ol data-anchor-id="kh44">
<li>maven-release-plugin发布</li>
</ol><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="sljr"><ol class="linenums"><li class="L0"><code><span class="pln">mvn release</span><span class="pun">:</span><span class="pln">prepare </span><span class="pun">-</span><span class="typ">Dresume</span><span class="pun">=</span><span class="kwd">false</span><span class="pln"> </span><span class="pun">-</span><span class="pln">P release </span><span class="com"># 上传SNAPSHOT版本代码</span></code></li><li class="L1"><code></code></li><li class="L2"><code><span class="pln">mvn release</span><span class="pun">:</span><span class="pln">rollback </span><span class="com"># 有错误</span></code></li><li class="L3"><code></code></li><li class="L4"><code><span class="pln">mvn release</span><span class="pun">:</span><span class="pln">clean </span><span class="com">#清理项目</span></code></li><li class="L5"><code></code></li><li class="L6"><code><span class="pln">mvn release</span><span class="pun">:</span><span class="pln">perform </span><span class="pun">-</span><span class="pln">P release </span><span class="com"># 发布正式版本</span></code></li></ol></pre></div>
</body>
</html>